package com.xt.core.helper;

import java.io.File;
import java.io.FilenameFilter;

/**
 * filter the file with the given extention
 * 
 * @author txiao
 *
 */
public class FileTypeFilter implements FilenameFilter {
	private String extension; 

	public FileTypeFilter(String extension) {
		this.extension = extension;
	}

	public boolean accept(File directory, String filename) {
		boolean fileOK = true;

	    if (extension != null) {
	      fileOK &= filename.endsWith('.' + extension);
	    }
	    return fileOK;
	}
}